#!/usr/bin/perl

use lib::abs qw( .. ../../base_lib );
use JIP::ToolSet;

use Test::More tests => 16;

BEGIN { use_ok 'Net::FTP::Client::Listing::System::DOS'; }
require_ok 'Net::FTP::Client::Listing::System::DOS';

can_ok 'Net::FTP::Client::Listing::System::DOS', qw( new init parseDir );

{
    my $l = Net::FTP::Client::Listing::System::DOS->new();

    isa_ok $l, 'Net::FTP::Client::Listing::System::DOS';
    isa_ok $l, 'Net::FTP::Client::Listing';
    isa_ok $l, 'Class::Base';

    {
        my @l = $l->parseDir('02-05-96  10:48AM                 1415 src.slf');

        is( $l[0]->{'name'}, 'src.slf', 'parseDir(file) - record name' );
        is( $l[0]->{'type'}, 'f',       'parseDir(file) - record type' );
        is( $l[0]->{'size'}, '1415',    'parseDir(file) - record size' );

        is( $l[1], undef, 'parseDir(file) - empty record' );
    }

    {
        my @l = $l->parseDir('09-10-96  09:18AM       <DIR>          sl_util');

        is( $l[0]->{'name'}, 'sl_util', 'parseDir(dir) - record name' );
        is( $l[0]->{'type'}, 'd',       'parseDir(dir) - record type' );
        is( $l[0]->{'size'}, undef,     'parseDir(dir) - record size' );

        is( $l[1], undef, 'parseDir(dir) - empty record' );
    }

    {
        my @l = $l->parseDir('09-10-96  09:18AM       <DIR>          .');

        is( $l[0], undef, 'parseDir(dir) - empty record for .' );
    }

    {
        my @l = $l->parseDir('09-10-96  09:18AM       <DIR>          ..');

        is( $l[0], undef, 'parseDir(dir) - empty record for ..' );
    }

}
